//
//  YSHRFunctionViewController.m
//  YaSha-iOS
//
//  Created by 方鹏俊 on 2017/10/17.
//

#import "YSHRFunctionViewController.h"

#import "YSAttendanceViewController.h"    // 考勤
#import "YSPerfFunctionViewController.h"    // 绩效
#import "YSSalaryLoginController.h"//工资登录
#import "YSHRInfoSelfHelpController.h"//信息自助
@interface YSHRFunctionViewController ()

@end

@implementation YSHRFunctionViewController

- (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
    [TalkingData trackPageBegin:@"HR服务"];
}

//设置统计离开该模块
- (void)viewWillDisappear:(BOOL)animated {
      [super viewWillDisappear:animated];
    [TalkingData trackPageEnd:@"HR服务"];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"HR服务";
    [self getDatasourceArray];
}

- (void)getDatasourceArray {
    [self.dataSourceArray addObjectsFromArray:[YSDataManager getApplicationsData:@[@{@"id": @"0",
                                                                                     @"name": @"考勤",
                                                                                     @"imageName": @"ic_app_hr_check",
                                                                                     @"className": @"YSAttendanceViewController"},
                                                                                   @{@"id": @"1",
                                                                                     @"name": @"绩效管理",
                                                                                     @"imageName": @"ic_app_hr_perfor",
                                                                                     @"className": @"YSPerfFunctionViewController"},
                                                                                   @{@"id":@"2",
                                                                                     @"name":@"薪资条",                      @"imageName":@"ic_app_hr_pay",
                                                                                     @"className": @"YSSalaryLoginController"},
                                                                                   @{@"id": @"3",
                                                                                     @"name": @"信息自助",
                                                                                     @"imageName": @"ic_app_hr_info",
                                                                                     @"className": @"YSHRInfoSelfHelpController"},
                                                                                   ]]];



    self.imageName = @"HR";
    [self.collectionView reloadData];
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    YSApplicationModel *model = self.dataSourceArray[indexPath.row];
    Class someClass = NSClassFromString(model.className);
    UIViewController *viewController = [[someClass alloc] init];
    [self.navigationController pushViewController:viewController animated:YES];
}

@end
